package com.yz.house.ui.adaper;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.view.ViewGroup;


import com.yz.house.base.BaseFragment;

import java.util.List;

/**
 * Created on 2018-03-19 15:15.
 * 主页面FragmentPagerAdapter
 *
 * @author Y
 */
public class ViewPagerAdapter extends FragmentPagerAdapter {
    private List<BaseFragment> mFragmentList;
    private String[] mTitles;

    public ViewPagerAdapter(FragmentManager manager, List<BaseFragment> fragmentList, String[] titles) {
        super(manager);
        this.mFragmentList = fragmentList;
        this.mTitles = titles;
    }

    @Override
    public Fragment getItem(int position) {
        return mFragmentList.get(position);
    }

    @Override
    public int getCount() {
        return mTitles.length;
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        return super.instantiateItem(container, position);
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        super.destroyItem(container, position, object);
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return mTitles[position];
    }
}
